package org.lanqiao.tjut.java;

public class Length {
	private double value=0;
	private String scale="none";
	private boolean isValid=false;
	public Length (double _Value,String _scale){
		value= _Value;
		scale=_scale;
		if((value>=0)&&((scale .equals("meters"))||(scale.equals("feet"))))
        isValid=true;
	}
	public Length convertToFeet(){
	
		if((scale.equals("feet"))||(!isValid))
			return this;
		else
			return new Length(value*3.2809,"feet");
		
	}
	
	public void showLength(){
		if (isValid)
			System.out.println(value+""+scale);
		else
			System.out.println("invalid length");
		
			
		
	}
	
	
		
	
	
	
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
